<?php

// $Id$


require_once(TANGRA_MAIN_DIR.'db/paginate_db_data.class.php');
require_once(TANGRA_MAIN_DIR.'grids/grid_ctrl.class.php');

require_once($WSC->get_site_inc_dir().'modules/admin_panel/grids/admin_user_log/admin_user_log_grid.class.php');
require_once($WSC->get_site_inc_dir().'modules/user_auth_basic/classes/user_activity_dbc.class.php');


class Admin_User_Log_Grid_Ctrl extends Grid_Ctrl {
	private $user_id;

	function __construct($system_name, Vars_Manager $vm, $method = Tangra_Parameter_Method::GET, $user_id) {
		$this->user_id = $user_id;
		parent::__construct($system_name, $vm, $method);
	}


	protected function create_grid() {
		$ret = new Admin_User_Log_Grid();

		return $ret;
	}


	protected function create_paginate_db_data() {
		$sqls = User_Activity_DBC::get_sql_for_grid($this->user_id, 'admin_');
		$sqlc = User_Activity_DBC::get_sql_count_for_grid($this->user_id, 'admin_');

		$pdbd = new Paginate_DB_Data($this->grid->get_page_size(), $sqls, $sqlc);

		return $pdbd;
	}
}